﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataTier
{
    [KnownType(typeof(Subscription))]
    [DataContract(IsReference = true)]
    public class Customer
    {
        private List<Subscription> _subscriptions;
        private int _customerId;
        private string _userName;
        private string _name;
        private string _address;
        private int _zipCode;
        private string _email;
        private string _password;
        private string _city;

        #region Constructors

        public Customer(int customerId, string name, string email, string password)
        {
            this._customerId = customerId;
            this._name = name;
            this._email = email;
            this._password = password;
            this._subscriptions = new List<Subscription>();
        }

        public Customer(string name, string address, int zip, string email, string password)
        {
            this._name = name;
            this._address = address;
            this._zipCode = zip;
            this._email = email;
            this._password = password;
        }


        public Customer(int id, string userName, string name, string address, int zip, string city, string email, string password)
        {
            this._customerId = id;
            this._userName = userName;
            this._name = name;
            this._address = address;
            this._zipCode = zip;
            this._email = email;
            this._password = password;
            this._city = city;
        }

        public Customer(int id, string name)
        {
            this._customerId = id;
            this._name = name;
            _subscriptions = new List<Subscription>();
        }

        public Customer(string password)
        {
            this._password = password;
        }
        public Customer(int cust)
        {
            this.CustomerId = cust;
        }

        #endregion


        public override string ToString()
        {
            return Name;
        }

        #region Properties

        [DataMember]
        public int CustomerId
        {
            get { return _customerId; }
            set { _customerId = value; }
        }

        [DataMember]
        public string UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }

        [DataMember]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        [DataMember]
        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }

        [DataMember]
        public int ZipCode
        {
            get { return _zipCode; }
            set { _zipCode = value; }
        }

        [DataMember]
        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }

        [DataMember]
        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }

        [DataMember]
        public List<Subscription> Subscriptions
        {
            get { return _subscriptions;}
            set { _subscriptions = value; }
        }

        #endregion

    }
}
